home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-01-21 | 32.9 KB | 1,218 lines |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SHELL PROGRAM INTERFACE
-
- WordPerfect Corporation
-
-
- Version 1.0
- February, 1986
-
-
-
-
-
-
-
- SHELL PROGRAM INTERFACE -- TECHNICAL SPECIFICATION
-
- This specification contains the information necessary to write programs that
- interact with WordPerfect's Shell program manager. The following summary lists
- the information contained in each chapter of this document.
-
-
- Chapter 1 -- Introduction to the Shell
-
- This chapter introduces the Shell program manager in general, it's capabilities,
- and the benefits to be gained by writing programs that interact directly with the
- Shell.
-
- Chapter 2 -- Writing programs that interact with the Shell
-
- This chapter gives some basic guidelines for writing programs that interact with
- the Shell. It contains the general steps necessary for a program to interface to
- the Shell.
-
- Chapter 3 -- Testing for the presence of the Shell
-
- This chapter describes the method that programs should use to determine if the
- Shell is present in the system. An example procedure (in assembly language) is
- given to illustrate the method.
-
- Chapter 4 -- Shell Functions
-
- This chapter details each of the available Shell functions, and gives the input
- parameters, results, possible error codes, and examples in assembly language for
- each.
-
- Chapter 5 -- User Interface guidelines and suggestions
-
- This chapter gives some basic guidelines on implementing the Shell interface so
- that the user will be able to take advantage of all of the Shell's capabilities.
-
- Appendix
-
- A - File Formats for the Clipboard
- B - Memory Considerations
-
-
-
-
-
-
-
-
-
-
-
-
- 2
-
-
-
-
-
- CHAPTER 1 -- INTRODUCTION TO THE SHELL
-
-
- The Shell is a program manager/integrator developed by WordPerfect Corporation
- to help integrate WordPerfect, MathPlan, and other programs.
-
- The Shell provides the user with a program menu from which programs, DOS
- commands, batch files, and utilities can be executed. The user can setup the
- menu to include whatever programs he or she wishes.
-
- The user can load several programs into memory concurrently, and switch
- between those programs at will under the Shell. The Shell also provides a
- "clipboard", or buffer, for moving data (text, numbers, graphs, etc.) easily
- between programs.
-
- Included with the Shell in the WordPerfect Library package are several desktop
- utility programs, such as a calculator, a calendar, a notebook, a DOS file
- manager, and others -- all of which can cut and paste information to and from
- the clipboard.
-
- A program that can interact directly with the Shell can take advantage of the
- following features and capabilities:
-
- 1. Suspend operation and transfer control to the Shell manager. This
- allows the user to load other programs concurrently and switch back
- and forth between programs with the press of a key. For example,
- the user is able to pop into any of the desktop utilities (calculator,
- calendar, notebook, etc.) that are included with the Shell.
-
- 2. Write or append ASCII text to the Shell's clipboard. This allows the
- user to easily move data from one program to another.
-
- 3. Retrieve a copy of text in the Shell's clipboard.
-
- 4. Take of advantage of Expanded Memory, if available. If the user has
- an Intel AboveBoard (c), or other Expanded Memory board that meets
- the Lotus/Intel/Microsoft Specification, the Shell will automatically
- swap programs out to the the expanded memory above 640K. This
- allows the user to load up many more programs at once than would
- normally fit in 640K of conventional memory.
-
- All programs, even those that do not interact directly with the Shell, can take
- advantage of the following Shell features and capabilities:
-
- 1. Start the program from the Shell menu with the press of a key. The
- user can specify which directory to make the new default directory
- before starting the program. Command line arguments can also be
- specified for each program on the Shell menu. The user can also
- create sub-menus for organizing their hard disk and programs in
- logical groupings.
-
-
-
- 3
-
-
-
-
-
- 2. Use the Shell keyboard macro facility. This allows the user to define
- a series of keystrokes and assign them to either an ALT-SHIFT-letter
- combination or to a filename on disk. The keystrokes that were
- recorded can be played back from any program. There is no limit
- (except disk space) to the number or length of Shell macros that can
- be created.
-
- 3. Execute DOS commands, batch files, or Shell utilities from the Shell
- menu.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 4
-
-
-
-
-
- CHAPTER 2 -- WRITING PROGRAMS THAT INTERACT WITH
- THE SHELL
-
-
- In order for a program to interact directly with the Shell, it must perform the
- following basic steps:
-
- 1. Test to see whether or not the Shell is present in the system. A
- method for doing this is described in detail in Chapter 3.
-
- 2. If the Shell is present, use Function 50h to request a unique program
- ID code. This code is then used in subsequent function calls to the
- Shell.
-
- 3. Release any memory that is not needed. The program should
- determine what memory it needs for data, buffers, etc., and release
- any extra memory using DOS function 4Ah.
-
- When DOS loads a program into memory, all available memory is
- assigned to that program. In order for the Shell to be able to load
- other programs concurrently into memory, programs that interact with
- the Shell must release extra memory by "shrinking" down with DOS
- function 4Ah. This should be done as soon as the program determines
- that it has been loaded under the Shell.
-
- Most WordPerfect programs use less memory for buffers, etc. when
- loaded under the Shell than they do when loaded normally from DOS.
- This makes it possible to load several program concurrently under the
- Shell.
-
- 4. Use Shell Function 57h to determine if the Shell is loading the
- program as part of a "start-up" procedure. If so, the program should
- do any initialization, then transfer control back to the Shell (using
- Function 50h) before modifying the screen or asking for any user
- input.
-
- 5. Check user input where applicable for the "Shell" key (Ctrl-F1) and
- use the Shell functions to interact with the Shell (i.e., go to Shell
- temporarily, write or append data to the clipboard, get data from the
- clipboard, etc.)
-
- 6. Before terminating, the program should issue Function 55h (Request
- permission to exit) so that the Shell can insure that all programs exit
- in the reverse order that they were loaded into memory. This is
- necessary for DOS to operate properly.
-
- Chapters 3 and 4 describe how to test for the Shell and make function calls to
- the Shell.
-
-
-
-
-
- 5
-
-
-
-
-
- CHAPTER 3 -- TESTING FOR THE PRESENCE OF THE SHELL
-
- This chapter describes how to use the DOS "get interrupt vector" technique to
- test whether or not the Shell is present. Any program can use these steps to
- test for the presence of the Shell.
-
- 1. Use the DOS "get interrupt vector" command (DOS function 35h) to get the
- contents of interrupt vector number 1Ah (addresses 0000:0068 through
- 0000:006B).
-
- The Shell uses this interrupt vector to perform all interaction between
- application programs and the Shell manager. The OFFSET of the interrupt
- service routine address is stored in the word located at address 0000:0068h;
- the SEGMENT address is stored in the word located at address 0000:006Ah.
-
- 2. Compare the contents of an ASCII string which starts at the address
- specified by the contents of the interrupt vector 1Ah plus a fixed offset of
- 2 bytes to the string "SHELL001".
-
- If the result of the string comparison is positive, the Shell is present and
- can be called via interrupt 1Ah.
-
-
- Example
-
- The following code is an example of the technique described above to determine
- if the Shell is present.
-
- ;****************************************************************
- ;
- ; The following procedure determines whether or not the Shell
- ; is present in the system.
- ;
- ; RESULT: CARRY FLAG is SET if the Shell is present
- ; CARRY FLAG is CLEAR if the Shell is not present
- ;
- ;****************************************************************
-
- Test_For_Shell PROC NEAR
-
- PUSH AX
- PUSH BX
- PUSH CX
- PUSH SI
- PUSH DI
- PUSH DS
- PUSH ES
-
- PUSH CS
- POP DS ; prepare DS for string compare
-
- MOV AH,35h
-
- 6
-
-
-
-
-
- MOV AL,1Ah ; issue "get interrupt vector"
- INT 21h
-
- MOV DI,BX
- ADD DI,2
-
- MOV SI,OFFSET ascii_name
-
- MOV CX,8
- CLD
- REPE CMPSB
- JNE Test_No
-
- Test_Yes:
- STC
- JMP Test_Exit
-
- Test_No:
- CLC
-
- Test_Exit:
- POP ES
- POP DS
- POP DI
- POP SI
- POP CX
- POP BX
- POP AX
- RET
-
- ascii_name: DB "SHELL001"
-
- Test_For_Shell ENDP
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 7
-
-
-
-
-
- CHAPTER 4 -- SHELL FUNCTIONS
-
-
- All interaction with the Shell manager is performed by issuing interrupt 1Ah.
- The contents of the registers before and after issuing the interrupt will vary
- depending on the Shell function being called. The function number is always
- passed in register AH. For all functions except Function 50h (Get Program ID),
- the program ID code is passed in register AL.
-
- For all functions, register AH returns an error status code. The possible error
- status codes are listed for each function. In general, if AH is zero, the function
- executed normally. If AH is non-zero, an error of some kind occurred.
-
- For all functions, if AH is 0FFh on return, an invalid Function code number was
- passed in AH.
-
- For each function, the input parameters, results, possible error codes, and an
- example in assembly language are given.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 8
-
-
-
-
-
- Function 50h -- Get Program ID
-
-
- This function is used to return a unique program ID code to the caller. This
- should be the first function used by the calling program, and should be called as
- soon as the program determines that the Shell is present.
-
- For all subsequent function calls, the program ID code should be passed in
- register AL.
-
-
- IN: AH contains the function number (50h)
-
- OUT: AL contains the Program ID code
- AH contains an error code
-
- EXAMPLE:
-
- MOV AH,50h
- INT 1Ah
- OR AH,AH
- JNZ error_handler
-
- ERROR CODES:
-
- AH = 0 No error.
- AH = 1 No Program ID code available.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 9
-
-
-
-
-
- Function 51h -- Go to Shell
-
-
- This function is used to temporarily suspend the calling program and transfer
- control to the Shell manager. The Shell menu will be displayed and the user is
- allowed to select from among the entries on the menu.
-
- When the user elects to return to the calling program, the Shell transfers
- control back to the caller by returning from the interrupt.
-
- It is very important that the calling program check the error status code in AH
- on return from this interrupt. The user may have elected to exit all programs
- that are loaded under the Shell, in which case the caller will need to "close up
- shop" and terminate.
-
- IN: AH contains the function number (51h)
- AL contains the Program ID (returned by Function 50h)
-
- OUT: AH contains an error code
-
- EXAMPLE:
-
- MOV AH,51h
- MOV AL,program_ID
- INT 1Ah
- OR AH,AH
- JZ continue_with_program
- DEC AH
- JZ unable_to_transfer_to_shell
- DEC AH
- JZ exit_program
- DEC AH
- JZ exit_program_but_save_info_first
-
- ERROR CODES:
-
- AH = 0 No error, continue with program.
- AH = 1 Unable to transfer control to Shell -- continue with
- program or issue error message.
- AH = 2 User wishes to exit all programs that are loaded under the
- Shell. Close up files, etc., and terminate.
- AH = 3 User wishes to save any information (documents, worksheets,
- etc.) that has been modified, and then exit all programs that
- are loaded under the Shell. Save any updated information
- (this may require user interaction), and terminate.
-
- Note: When this function is called, the Shell saves the following information
- about the caller's "state" on the caller's stack:
-
- 1. ALL registers except AX
- 2. All flags
- 3. The current cursor position and mode
-
- 10
-
-
-
-
-
- 4. The current DOS DTA address
- 5. The following interrupt vectors:
- - Divide overflow
- - Critical error handler
-
- The above "state" is restored before the Shell returns control to the caller.
-
- If AH contains a 2 or 3 (terminate) code on return from this function, the
- calling program should still issue Function 55h (Request permission to exit)
- before actually terminating.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 11
-
-
-
-
-
- Function 52h -- Write Data to Clipboard
-
-
- Use this function to write the data specified by DS:SI and CX registers to the
- clipboard. Any previous information contained in the clipboard is lost. Use
- Function 53h to append or add data to the clipboard.
-
- The clipboard is virtual in nature, so if the data is too large for the 5K memory
- buffer reserved for the clipboard, a temporary file will automatically be created
- on disk, and the additional information will be stored there.
-
-
- IN: AH contains the function number (52h)
- AL contains the Program ID code
- BL contains a format type code as follows:
- 1 = data is in WP text format
- 2 = data is in WP Merge File format
- 3 = data is in ASCII text format
- (see Appendix for explanation of format codes)
-
- CX contains the number of bytes to write
- Note: Calling programs should write or append no more than 5K
- bytes at a time to the clipboard. The amount of data that can
- be stored in the clipboard is limited only by disk space, but the
- maximum "chunk" that the Shell can handle per call is 5K bytes.
- DS:SI contains the segment and offset of the location in memory
- where the data to be written is stored.
-
- OUT: AH contains an error code
-
- EXAMPLE:
-
- MOV AH,52h
- MOV AL,program_ID
- MOV BL,format_type
- MOV CX,number_of_bytes
- MOV SI,offset_of_data ; DS is segment of data
- INT 1Ah
- OR AH,AH
- JNZ error_handler
-
- ERROR CODES:
-
- AH = 0 No error.
- AH = 1 No room to add data to clipboard (Disk Full error).
- AH = 2 Invalid format type.
-
-
-
-
-
-
-
- 12
-
-
-
-
-
- Function 53h -- Append Data to Clipboard
-
-
- This function is similar to Function 52h, but appends the data to the end of the
- clipboard.
-
- IN: AH contains the function number (53h)
- AL contains the Program ID code
- BL contains a format type code as follows:
- 1 = data is in WP text format
- 2 = data is in WP Merge File format
- 3 = data is in ASCII text format
- (see Appendix for explanation of format codes)
-
- CX contains the number of bytes to write
- No more than 5K bytes at a time (see note under Function 52h -
- - Write to Clipboard)
- DS:SI contains the segment and offset of the location in memory
- where the data to be appended is stored.
-
- OUT: AH contains an error code
-
- EXAMPLE:
-
- MOV AH,53h
- MOV AL,program_ID
- MOV BL,format_type
- MOV CX,number_of_bytes
- MOV SI,offset_of_data ; DS is segment of data
- INT 1Ah
- OR AH,AH
- JNZ error_handler
-
- ERROR CODES:
-
- AH = 0 No error.
- AH = 1 No room to add data to clipboard (Disk Full error).
- AH = 2 Invalid format type.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 13
-
-
-
-
-
- Function 54h -- Retrieve Data from Clipboard
-
-
- Use this function to retrieve data from the clipboard. The number of bytes is
- returned in CX. The calling program should continue making this function call
- until CX equals 0, meaning there is no more data to be retrieved from the
- clipboard. If CX is zero on the first call, the clipboard is empty.
-
- Function 56h can be used to determine whether the data in the clipboard is in a
- text format (WP or ASCII) or in a mail-merge format (WP Merge File).
-
- IN: AH contains the function number (54h).
- AL contains the Program ID code.
- BL contains a format type code as follows:
- 1 = request data in WP text format
- 2 = request data in WP Merge File format
- 3 = request data in ASCII text format
- (see Appendix for explanation of format codes)
-
- OUT: AH contains an error code
- CX contains number bytes of data returned (0 = empty)
- Note: The Shell will hand back approximately 128 bytes at a time.
- The program should continue calling Function 54h until CX = 0.
- ES:DI contains the segment and offset of the buffer where the data is
- located.
-
- EXAMPLE:
-
- Read_clipboard:
- MOV AH,54h
- MOV AL,program_ID
- MOV BL,format_type
- INT 1Ah
- OR AH,AH
- JNZ error_handler
- JCXZ no_more_data
-
- ; PROCESS CX BYTES AT ES:DI
-
- JMP Read_clipboard
- no_more_data:
-
- ERROR CODES:
-
- AH = 0 No error.
- AH = 1 Disk I/O error -- can't retrieve data
- AH = 2 Invalid format type request (i.e., requested data in WP
- Merge File format when data in clipboard was WP text or
- ASCII text)
-
-
-
-
- 14
-
-
-
-
-
- Function 55h -- Request Permission to Exit
-
-
- Because the Shell uses DOS to load programs and manage memory, programs must
- be exited in the reverse order that they were loaded into memory. This requires
- that a program request permission from the Shell just prior to terminating. The
- Shell will return control to the program when it is time to exit.
-
- IN: AH contains the function number (55h)
- AL contains the Program ID code
-
- OUT: AH contains an error code
-
- EXAMPLE:
-
- MOV AH,55h
- MOV AL,program_ID
- INT 1Ah
- OR AH,AH
- JNZ go_ahead_and_terminate
- JMP restart_program
-
- ERROR CODES:
-
- AH = 0 Restart program -- user wishes to re-enter program.
- AH <> 0 Go ahead and terminate program.
-
- Note: The calling program should use DOS function 4Ch to terminate.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 15
-
-
-
-
-
- Function 56h -- Check Clipboard Format
-
-
- Use this function to return a format type code indicating what type of data is
- currently in the clipboard (text or mail merge format).
-
- IN: AH contains the function number (56h)
- AL contains the Program ID code
-
- OUT: AH contains the format type code:
- 0 = data is text (WP or ASCII)
- 1 = data is mail-merge format (WP Merge)
-
- EXAMPLE:
-
- MOV AH,56h
- MOV AL,program_ID
- INT 1Ah
-
- ERROR CODES:
-
- No errors are defined for this function
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 16
-
-
-
-
-
- Function 57h -- Check if Shell is installing program resident
-
-
- This function should be issued by the calling program after it has requested a
- program ID code, and after it has released any extra memory, but before it
- modifies the screen or does any user interaction.
-
- If the function returns a 1 in AL, the user wants to load this program into
- memory as he (she) is starting the Shell, but does not wish to begin using the
- program until they select it from the Shell menu. If this is the case, the calling
- program should go ahead and complete any initialization required, and then use
- Function 1 to transfer control to the Shell manager.
-
- IN: AH contains the function number (57h)
- AL contains the Program ID code
-
- OUT: AH contains an error code
- AL = 1 if program should transfer control to Shell immediately before
- starting.
-
- EXAMPLE:
-
- MOV AH,57h
- MOV AL,program_ID
- INT 1Ah
- OR AH,AH
- JNZ error_handler
- OR AL,AL
- JZ continue_with_program
-
- MOV AH,51h ; transfer to Shell
- MOV AL,program_ID
- INT 1Ah
- OR AH,AH
- JZ continue_with_program
- DEC AH
- JZ continue_with_program
- DEC AH
- JAE exit_program
-
- continue_with_program:
-
- ERROR CODES:
-
- AH = 0 No error
- AH = 1 Invalid program ID code
-
-
-
-
-
-
-
- 17
-
-
-
-
-
- Function 58h -- Test if Shell is using Expanded Memory
-
-
- This function allows programs to determine whether or not the Shell is using
- Expanded Memory. If so, the programs do not need to release memory when
- they start, but can take as much or all of the 640K conventional memory as they
- wish.
-
- IN: AH contains the function number (58h)
-
- OUT: AL contains 1 if Expanded Memory is being used.
-
- EXAMPLE:
-
- MOV AH,58h
- INT 1Ah
- OR AL,AL
- JZ no_expanded_memory
- JMP can_use_all_conventional_memory
-
- ERROR CODES:
-
- No errors are defined for this function
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 18
-
-
-
-
-
- CHAPTER 5 -- USER INTERFACE GUIDELINES AND
- SUGGESTIONS
-
-
- All programs (to date) that interact with the Shell use Ctrl-F1 as the "Shell"
- key. We highly recommend that all programs that interact with the Shell use
- Ctrl-F1 to go to the Shell, interact with the clipboard, etc.
-
- One of the features of the Shell is the capability for the user to switch between
- programs by pressing an ALT-SHIFT-letter key combination. This feature is
- implemented as a Shell macro, and assumes that the normal procedure to go to
- the Shell consists of pressing Ctrl-F1 and then 1. For this reason, we also
- recommend that a menu be displayed when the user presses Ctrl-F1, where the
- first option is Go to Shell. This will allow the user to use the "shortcut"
- method of switching to and from your program.
-
- We suggest that programs which intend to support the Shell directly look
- through the Shell User's Manual (particulary the Program Profiles in the
- Appendix) to get a feel for how WordPerfect programs interact with the Shell.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 19
-
-
-
-
-
- APPENDIX
-
- A. File Formats
-
-
- Information can be passed to and retrieved from the clipboard in one of the
- following formats:
-
- 1. WP Text -- WordPerfect Text format. Data in this format contains text
- characters interspersed with WordPerfect function codes. WordPerfect
- function codes range from 128 to 255 decimal. "Extended characters" which
- would normally occupy this range are preceeded and followed by a special
- "gate" -- the function code 0E1h. Newlines are indicated by a single
- linefeed (0Ah). Only programs which are familiar with WordPerfect
- function codes should attempt to read or write to the clipboard using this
- format.
-
- 2. WP Merge File -- WordPerfect mail-merge format. This is the same as
- WP Text (text interspersed with WP function codes), but the text is
- formatted into a field & record orientation. A ^R and linfeed (0Ah) follow
- each field and a ^E and linefeed (0Ah) follow each record. This format
- should only be used by programs which are able to strip out WordPerfect
- function codes.
-
- 3. ASCII Text -- ASCII Text format. Data in this format consists of
- normal ASCII text. Newlines are represented by a carriage return
- (0Dh)/linefeed (0Ah) combination. Codes above 128 are assumed to be
- extended characters (foreign, line-drawing characters, etc.) This format can
- and should be used by all programs which need to communicate with the
- clipboard, but do not wish to worry about WordPerfect function codes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 20
-
-
-
-
-
- B. Memory Considerations
-
- As explained in Chapter 2, programs which interact with the Shell need to
- release any memory that they do not need when they start. Many programs
- normally take all available memory. In this case, the program should make
- exception when being loaded under the Shell, take a reasonble amount of memory
- (or allow the user to specify how much to use) and release the rest for use by
- other Shell programs.
-
- The Shell itself takes about 25K of memory.
-
- The Shell supports the Lotus/Intel/Microsoft Expanded Memory Specification.
- The Shell will automatically sense if Expanded Memory is availabe and swap
- programs out to Expanded Memory when necessary. When the Shell is run from
- Expanded Memory, each program can use all or as much of the 640K
- conventional memory as it desires. When programs are not currently running
- they are swapped out to Expanded Memory by the Shell.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 21
-